﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
using System.Text.Json.Serialization;
using Digitalmes.Model;

namespace Digitalmes.Model.ProductionManagement
{
    /// <summary>
    /// 生产状态
    /// </summary>
	[Table("ProductionTransSn")]

    [Display(Name = "_Model.ProdTransSn")]
    public class ProductionTransSn : BasePoco,IPersistPoco,ITenant
    {
        [Key]
        [Display(Name = "_Model._ProdTransSn._ID")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public new long ID { get; set; }
        [Display(Name = "_Model._ProdTransSn._Sn")]
        [Comment("追溯码")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public string Sn { get; set; }
        [Display(Name = "_Model._ProdTransSn._ProductId")]
        [Comment("产品Id")]
        public long? ProductId { get; set; }
        [Display(Name = "_Model._ProdTransSn._ProductCode")]
        [Comment("产品编码")]
        public string ProductCode { get; set; }
        [Display(Name = "_Model._ProdTransSn._Wo")]
        [Comment("工单号")]
        public string Wo { get; set; }
        [Display(Name = "_Model._ProdTransSn._CurLineId")]
        [Comment("所在产线Id")]
        public long? CurLineId { get; set; }
        [Display(Name = "_Model._ProdTransSn._CurLineCode")]
        [Comment("所在产线编号")]
        public string CurLineCode { get; set; }
        [Display(Name = "_Model._ProdTransSn._CurOpId")]
        [Comment("所在工位 Id")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public long? CurOpId { get; set; }
        [Display(Name = "_Model._ProdTransSn._CurOpCode")]
        [Comment("所在工位编号")]
        public string CurOpCode { get; set; }
        [Display(Name = "_Model._ProdTransSn._CurRoutingId")]
        [Comment("所在工艺路线 Id")]
        public long? CurRoutingId { get; set; }
        [Display(Name = "_Model._ProdTransSn._CurRoutingCode")]
        [Comment("所在工艺路线编号")]
        public string CurRoutingCode { get; set; }
        [Display(Name = "_Model._ProdTransSn._InboundTime")]
        [Comment("工位进站时间")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public DateTime? InboundTime { get; set; }
        [Display(Name = "_Model._ProdTransSn._OutboundTime")]
        [Comment("工位出站时间")]
        public DateTime? OutboundTime { get; set; }
        [Display(Name = "_Model._ProdTransSn._OnlineTime")]
        [Comment("产品上线时间")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public DateTime? OnlineTime { get; set; }
        [Display(Name = "_Model._ProdTransSn._OfflineTime")]
        [Comment("产品下线时间")]
        public DateTime? OfflineTime { get; set; }
        [Display(Name = "_Model._ProdTransSn._Stage")]
        [Comment("工作阶段")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public SnStageEnum? Stage { get; set; }
        [Display(Name = "_Model._ProdTransSn._Status")]
        [Comment("状态")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public SnStatusEnum? Status { get; set; }
        [Display(Name = "_Model._ProdTransSn._IsCompelted")]
        [Comment("完工")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public bool? IsCompelted { get; set; }
        [Display(Name = "_Model._ProdTransSn._CustomerSn")]
        [Comment("客户SN")]
        public string CustomerSn { get; set; }
        [Display(Name = "_Model._ProdTransSn._ReworkFlag")]
        [Comment("返工标识")]
        public ReworkFlagEnum? ReworkFlag { get; set; }
        [Display(Name = "_Model._ProdTransSn._ReworkDoc")]
        [Comment("返工单据")]
        public string ReworkDoc { get; set; }
        [Display(Name = "_Model._ProdTransSn._ReworkCount")]
        [Comment("返修次数")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public int? ReworkCount { get; set; }
        [Display(Name = "_Model._ProdTransSn._NgSteps")]
        [Comment("NG步序号集合")]
        public string NgSteps { get; set; }
        [Display(Name = "_Model._ProdTransSn._IsNeedRework")]
        [Comment("是否需要进行返工")]
        [Required(ErrorMessage = "Validate.{0}required")]
        [NotMapped]
        public bool? IsNeedRework { get; set; }
        [Display(Name = "_Model._ProdTransSn._IsValid")]
        [Comment("是否有效")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public bool IsValid { get; set; } = true;
        [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
        public string TenantCode { get; set; }

	}

}
